\hypertarget{class_type_topic_counts}{
\section{TypeTopicCounts Class Reference}
\label{class_type_topic_counts}\index{TypeTopicCounts@{TypeTopicCounts}}
}


{\ttfamily \#include $<$TypeTopicCounts.h$>$}

\subsection*{Public Member Functions}
\begin{DoxyCompactItemize}
\item 
\hyperlink{class_type_topic_counts_a461c45af231cb3a4c6c116eb9daa5ee5}{TypeTopicCounts} ()
\item 
\hyperlink{class_type_topic_counts_a199efa3085b514a0e155e24d807fe749}{TypeTopicCounts} (word\_\-t num\_\-words, topic\_\-t \hyperlink{class_type_topic_counts_a11093a2580f604279b5799ef494a8e66}{num\_\-topics})
\item 
virtual \hyperlink{class_type_topic_counts_a96bfd72683e9d117836c6118e62f2957}{$\sim$TypeTopicCounts} ()
\item 
void \hyperlink{class_type_topic_counts_a1e51d6aa7ceb480b3b1e1a2e598a2486}{initialize\_\-from\_\-docs} (string wfname, string tfname)
\item 
int \hyperlink{class_type_topic_counts_adc1724643b2210fce240202fdfc5144c}{verify\_\-header} (\hyperlink{class_document_reader}{DocumentReader} \&doc\_\-rdr)
\item 
void \hyperlink{class_type_topic_counts_a54768567ed8fbf4cd34f2ff7a5222190}{initialize\_\-from\_\-string} (word\_\-t word, string \&counts)
\item 
bool \hyperlink{class_type_topic_counts_a71ca87bf1f9cf612323f792594d3de29}{initialize\_\-from\_\-dump} (string fname, \hyperlink{class_word_index_dictionary}{WordIndexDictionary} $\ast$local\_\-dict=NULL, \hyperlink{class_word_index_dictionary}{WordIndexDictionary} $\ast$global\_\-dict=NULL, size\_\-t offset=0)
\item 
void \hyperlink{class_type_topic_counts_ae8c2f500e74a2f6a6bb1f6e830c66142}{initialize\_\-from\_\-ttc} (\hyperlink{class_type_topic_counts}{TypeTopicCounts} $\ast$ttc)
\item 
void \hyperlink{class_type_topic_counts_af81d800d17306cb9f53e5bfe0ba49094}{estimate\_\-alphas} (double $\ast$alphas, double \&alpha\_\-sum)
\item 
void \hyperlink{class_type_topic_counts_ad5b4a0efaccdf397d696ef3a59ff5bc5}{dump} (string fname)
\item 
topic\_\-t \hyperlink{class_type_topic_counts_af6811be58a729eed6909236f0c22c554}{get\_\-counts} (word\_\-t word, \hyperlink{struct_topic_counts}{topicCounts} $\ast$tc)
\item 
topic\_\-t \hyperlink{class_type_topic_counts_a8fe14c5595b71fd856197e198ea67196}{get\_\-counts} (atomic$<$ topic\_\-t $>$ $\ast$tc)
\item 
word\_\-t \hyperlink{class_type_topic_counts_a18f351c45c28ebc4be0f0d3df001fde4}{get\_\-num\_\-words} ()
\item 
topic\_\-t \hyperlink{class_type_topic_counts_a443c1fcce5b88993cea9891137f9f5fa}{get\_\-num\_\-topics} ()
\item 
word\_\-mutex\_\-t $\ast$ \hyperlink{class_type_topic_counts_a109fdf5a24f0dc898d828e5ebe55e34f}{get\_\-lock} (word\_\-t word)
\item 
pair$<$ \hyperlink{class_top_k_list}{TopKList} $\ast$$\ast$, \hyperlink{class_top_k_list}{TopKList} $\ast$ $>$ \hyperlink{class_type_topic_counts_a0a41df650f7c2975f7517d02deb6d868}{get\_\-topic\_\-stats} ()
\item 
void \hyperlink{class_type_topic_counts_a8d29734547e3cbe1936282967b62c9e7}{replace} (word\_\-t word, \hyperlink{struct_topic_counts}{topicCounts} \&tc)
\item 
void \hyperlink{class_type_topic_counts_a6ccff3b11d661503a45bc382411af9ad}{upd\_\-count} (word\_\-t word, topic\_\-t old\_\-topic, topic\_\-t new\_\-topic, bool ignore\_\-old\_\-topic=false)
\item 
void \hyperlink{class_type_topic_counts_a4cdeb79b31cc51bf74b0cf2824aad62d}{upd\_\-count} (word\_\-t word, \hyperlink{types_8h_a4fed6ff282eca8f2c6ebdb4bc2e99e8b}{mapped\_\-vec} delta, string dbg=\char`\"{}\char`\"{})
\item 
bool \hyperlink{class_type_topic_counts_aca203c070ed5c7338ebfe7b2b2574ae4}{equal} (const \hyperlink{class_type_topic_counts}{TypeTopicCounts} \&expected)
\item 
string \hyperlink{class_type_topic_counts_a8aecfbf940bbc235954488ef3d107075}{print} (word\_\-t word)
\item 
void \hyperlink{class_type_topic_counts_a126d74c21ec8eda16a875711b9879f86}{print} ()
\item 
void \hyperlink{class_type_topic_counts_a0f6527f9f996e4e39859a6cb266ebf12}{initialize} (\hyperlink{struct_topic_counts}{topicCounts} $\ast$wtc, atomic$<$ topic\_\-t $>$ $\ast$tc, word\_\-t word=0)
\item 
void \hyperlink{class_type_topic_counts_ab788633dc25d325dc47bd333b87ae574}{initialize} (\hyperlink{struct_topic_counts}{topicCounts} $\ast$$\ast$wtc, atomic$<$ topic\_\-t $>$ $\ast$tc)
\end{DoxyCompactItemize}
\subsection*{Static Public Member Functions}
\begin{DoxyCompactItemize}
\item 
static pair$<$ int, float $>$ \hyperlink{class_type_topic_counts_a050a1b09ad130d2ac048511df424e53b}{estimate\_\-fit} (string fname, \hyperlink{class_word_index_dictionary}{WordIndexDictionary} $\ast$dict)
\item 
static pair$<$ int, float $>$ \hyperlink{class_type_topic_counts_ae32981836e13dd9a54bfd79224063a12}{estimate\_\-fit} (string fname, float used\_\-memory, int \&incoming\_\-words)
\end{DoxyCompactItemize}
\subsection*{Protected Member Functions}
\begin{DoxyCompactItemize}
\item 
void \hyperlink{class_type_topic_counts_ab69a6701ed9e110f9c5ac25e933899ec}{estimate\_\-memoryn\_\-warn} (long num\_\-elems)
\item 
void \hyperlink{class_type_topic_counts_a0e039d80803bd0d1310d8d34478651ec}{clear\_\-stats} ()
\item 
void \hyperlink{class_type_topic_counts_a6eb9abe7c1ca5cfeaf15d49b910fd24f}{init} (topic\_\-t num\_\-topics\_\-)
\item 
void \hyperlink{class_type_topic_counts_a0ed91f07819b6534de5592d22e6278d3}{destroy} ()
\end{DoxyCompactItemize}
\subsection*{Protected Attributes}
\begin{DoxyCompactItemize}
\item 
atomic$<$ topic\_\-t $>$ $\ast$ \hyperlink{class_type_topic_counts_ab1fcbc4b5558d7d8df4404d5db290e8d}{tokens\_\-per\_\-topic}
\item 
topic\_\-t \hyperlink{class_type_topic_counts_a11093a2580f604279b5799ef494a8e66}{num\_\-topics}
\item 
\hyperlink{class_top_k_list}{TopKList} $\ast$$\ast$ \hyperlink{class_type_topic_counts_a1fd0fdd37107d5837fe5cc78191f5e8a}{topic\_\-stats}
\item 
\hyperlink{class_top_k_list}{TopKList} $\ast$ \hyperlink{class_type_topic_counts_aa31724ba039f4e58d2ac2d3344b94d46}{top\_\-topics}
\end{DoxyCompactItemize}
\subsection*{Friends}
\begin{DoxyCompactItemize}
\item 
class \hyperlink{class_type_topic_counts_a262cd29ee3b1d36569101e365d04b725}{Memcached\_\-Synchronizer}
\end{DoxyCompactItemize}


\subsection{Constructor \& Destructor Documentation}
\hypertarget{class_type_topic_counts_a461c45af231cb3a4c6c116eb9daa5ee5}{
\index{TypeTopicCounts@{TypeTopicCounts}!TypeTopicCounts@{TypeTopicCounts}}
\index{TypeTopicCounts@{TypeTopicCounts}!TypeTopicCounts@{TypeTopicCounts}}
\subsubsection[{TypeTopicCounts}]{\setlength{\rightskip}{0pt plus 5cm}TypeTopicCounts::TypeTopicCounts ()}}
\label{class_type_topic_counts_a461c45af231cb3a4c6c116eb9daa5ee5}
Construct an empty Word\_\-Topic Counts table \hypertarget{class_type_topic_counts_a199efa3085b514a0e155e24d807fe749}{
\index{TypeTopicCounts@{TypeTopicCounts}!TypeTopicCounts@{TypeTopicCounts}}
\index{TypeTopicCounts@{TypeTopicCounts}!TypeTopicCounts@{TypeTopicCounts}}
\subsubsection[{TypeTopicCounts}]{\setlength{\rightskip}{0pt plus 5cm}TypeTopicCounts::TypeTopicCounts (word\_\-t {\em num\_\-words\_\-}, \/  topic\_\-t {\em num\_\-topics\_\-})}}
\label{class_type_topic_counts_a199efa3085b514a0e155e24d807fe749}
Constructs a Word Topic Counts table that will have num\_\-words\_\- unique words and each word can be assigned a maximum of num\_\-topics\_\- topics \hypertarget{class_type_topic_counts_a96bfd72683e9d117836c6118e62f2957}{
\index{TypeTopicCounts@{TypeTopicCounts}!$\sim$TypeTopicCounts@{$\sim$TypeTopicCounts}}
\index{$\sim$TypeTopicCounts@{$\sim$TypeTopicCounts}!TypeTopicCounts@{TypeTopicCounts}}
\subsubsection[{$\sim$TypeTopicCounts}]{\setlength{\rightskip}{0pt plus 5cm}TypeTopicCounts::$\sim$TypeTopicCounts ()\hspace{0.3cm}{\ttfamily  \mbox{[}virtual\mbox{]}}}}
\label{class_type_topic_counts_a96bfd72683e9d117836c6118e62f2957}


\subsection{Member Function Documentation}
\hypertarget{class_type_topic_counts_a0e039d80803bd0d1310d8d34478651ec}{
\index{TypeTopicCounts@{TypeTopicCounts}!clear\_\-stats@{clear\_\-stats}}
\index{clear\_\-stats@{clear\_\-stats}!TypeTopicCounts@{TypeTopicCounts}}
\subsubsection[{clear\_\-stats}]{\setlength{\rightskip}{0pt plus 5cm}void TypeTopicCounts::clear\_\-stats ()\hspace{0.3cm}{\ttfamily  \mbox{[}protected\mbox{]}}}}
\label{class_type_topic_counts_a0e039d80803bd0d1310d8d34478651ec}
Clears all the topic statistics \hypertarget{class_type_topic_counts_a0ed91f07819b6534de5592d22e6278d3}{
\index{TypeTopicCounts@{TypeTopicCounts}!destroy@{destroy}}
\index{destroy@{destroy}!TypeTopicCounts@{TypeTopicCounts}}
\subsubsection[{destroy}]{\setlength{\rightskip}{0pt plus 5cm}void TypeTopicCounts::destroy ()\hspace{0.3cm}{\ttfamily  \mbox{[}protected\mbox{]}}}}
\label{class_type_topic_counts_a0ed91f07819b6534de5592d22e6278d3}
\hypertarget{class_type_topic_counts_ad5b4a0efaccdf397d696ef3a59ff5bc5}{
\index{TypeTopicCounts@{TypeTopicCounts}!dump@{dump}}
\index{dump@{dump}!TypeTopicCounts@{TypeTopicCounts}}
\subsubsection[{dump}]{\setlength{\rightskip}{0pt plus 5cm}void TypeTopicCounts::dump (string {\em fname})}}
\label{class_type_topic_counts_ad5b4a0efaccdf397d696ef3a59ff5bc5}
Use the \hyperlink{class_document_writer}{DocumentWriter} to dump the topicCounts and the n(t) into a dump file (fname). Writes num\_\-words topicCounts vectors and then n(t) \hypertarget{class_type_topic_counts_aca203c070ed5c7338ebfe7b2b2574ae4}{
\index{TypeTopicCounts@{TypeTopicCounts}!equal@{equal}}
\index{equal@{equal}!TypeTopicCounts@{TypeTopicCounts}}
\subsubsection[{equal}]{\setlength{\rightskip}{0pt plus 5cm}bool TypeTopicCounts::equal (const {\bf TypeTopicCounts} \& {\em expected})}}
\label{class_type_topic_counts_aca203c070ed5c7338ebfe7b2b2574ae4}
\hypertarget{class_type_topic_counts_af81d800d17306cb9f53e5bfe0ba49094}{
\index{TypeTopicCounts@{TypeTopicCounts}!estimate\_\-alphas@{estimate\_\-alphas}}
\index{estimate\_\-alphas@{estimate\_\-alphas}!TypeTopicCounts@{TypeTopicCounts}}
\subsubsection[{estimate\_\-alphas}]{\setlength{\rightskip}{0pt plus 5cm}void TypeTopicCounts::estimate\_\-alphas (double $\ast$ {\em alphas}, \/  double \& {\em alpha\_\-sum})}}
\label{class_type_topic_counts_af81d800d17306cb9f53e5bfe0ba49094}
\hypertarget{class_type_topic_counts_ae32981836e13dd9a54bfd79224063a12}{
\index{TypeTopicCounts@{TypeTopicCounts}!estimate\_\-fit@{estimate\_\-fit}}
\index{estimate\_\-fit@{estimate\_\-fit}!TypeTopicCounts@{TypeTopicCounts}}
\subsubsection[{estimate\_\-fit}]{\setlength{\rightskip}{0pt plus 5cm}pair$<$ int, float $>$ TypeTopicCounts::estimate\_\-fit (string {\em fname}, \/  float {\em used\_\-memory}, \/  int \& {\em incoming\_\-words})\hspace{0.3cm}{\ttfamily  \mbox{[}static\mbox{]}}}}
\label{class_type_topic_counts_ae32981836e13dd9a54bfd79224063a12}
\hypertarget{class_type_topic_counts_a050a1b09ad130d2ac048511df424e53b}{
\index{TypeTopicCounts@{TypeTopicCounts}!estimate\_\-fit@{estimate\_\-fit}}
\index{estimate\_\-fit@{estimate\_\-fit}!TypeTopicCounts@{TypeTopicCounts}}
\subsubsection[{estimate\_\-fit}]{\setlength{\rightskip}{0pt plus 5cm}pair$<$ int, float $>$ TypeTopicCounts::estimate\_\-fit (string {\em fname}, \/  {\bf WordIndexDictionary} $\ast$ {\em dict})\hspace{0.3cm}{\ttfamily  \mbox{[}static\mbox{]}}}}
\label{class_type_topic_counts_a050a1b09ad130d2ac048511df424e53b}
\hypertarget{class_type_topic_counts_ab69a6701ed9e110f9c5ac25e933899ec}{
\index{TypeTopicCounts@{TypeTopicCounts}!estimate\_\-memoryn\_\-warn@{estimate\_\-memoryn\_\-warn}}
\index{estimate\_\-memoryn\_\-warn@{estimate\_\-memoryn\_\-warn}!TypeTopicCounts@{TypeTopicCounts}}
\subsubsection[{estimate\_\-memoryn\_\-warn}]{\setlength{\rightskip}{0pt plus 5cm}void TypeTopicCounts::estimate\_\-memoryn\_\-warn (long {\em num\_\-elems})\hspace{0.3cm}{\ttfamily  \mbox{[}protected\mbox{]}}}}
\label{class_type_topic_counts_ab69a6701ed9e110f9c5ac25e933899ec}
Used to estimate the amount of memory being used while initializing this structure in order to warn if it exceeds WARN\_\-MEMORY\_\-SIZE and fail if it exceeds MAX\_\-MEMORY\_\-USAGE \hypertarget{class_type_topic_counts_a8fe14c5595b71fd856197e198ea67196}{
\index{TypeTopicCounts@{TypeTopicCounts}!get\_\-counts@{get\_\-counts}}
\index{get\_\-counts@{get\_\-counts}!TypeTopicCounts@{TypeTopicCounts}}
\subsubsection[{get\_\-counts}]{\setlength{\rightskip}{0pt plus 5cm}topic\_\-t TypeTopicCounts::get\_\-counts (atomic$<$ topic\_\-t $>$ $\ast$ {\em tc})}}
\label{class_type_topic_counts_a8fe14c5595b71fd856197e198ea67196}
The memory for tc is assumed to be allocated. This method just copies the n(t) into tc \hypertarget{class_type_topic_counts_af6811be58a729eed6909236f0c22c554}{
\index{TypeTopicCounts@{TypeTopicCounts}!get\_\-counts@{get\_\-counts}}
\index{get\_\-counts@{get\_\-counts}!TypeTopicCounts@{TypeTopicCounts}}
\subsubsection[{get\_\-counts}]{\setlength{\rightskip}{0pt plus 5cm}topic\_\-t TypeTopicCounts::get\_\-counts (word\_\-t {\em word}, \/  {\bf topicCounts} $\ast$ {\em tc})}}
\label{class_type_topic_counts_af6811be58a729eed6909236f0c22c554}
The memory for topicCounts is assumed to have been allocated This method then just copied the topicCounts vector from the table into tc \hypertarget{class_type_topic_counts_a109fdf5a24f0dc898d828e5ebe55e34f}{
\index{TypeTopicCounts@{TypeTopicCounts}!get\_\-lock@{get\_\-lock}}
\index{get\_\-lock@{get\_\-lock}!TypeTopicCounts@{TypeTopicCounts}}
\subsubsection[{get\_\-lock}]{\setlength{\rightskip}{0pt plus 5cm}word\_\-mutex\_\-t $\ast$ TypeTopicCounts::get\_\-lock (word\_\-t {\em word})}}
\label{class_type_topic_counts_a109fdf5a24f0dc898d828e5ebe55e34f}
If you want to lock the structure externally, you can get the lock that controls access to the word by this method Method: word\_\-mutex\_\-t::scoped\_\-lock lock($\ast$get\_\-lock(word), false); \hypertarget{class_type_topic_counts_a443c1fcce5b88993cea9891137f9f5fa}{
\index{TypeTopicCounts@{TypeTopicCounts}!get\_\-num\_\-topics@{get\_\-num\_\-topics}}
\index{get\_\-num\_\-topics@{get\_\-num\_\-topics}!TypeTopicCounts@{TypeTopicCounts}}
\subsubsection[{get\_\-num\_\-topics}]{\setlength{\rightskip}{0pt plus 5cm}topic\_\-t TypeTopicCounts::get\_\-num\_\-topics ()}}
\label{class_type_topic_counts_a443c1fcce5b88993cea9891137f9f5fa}
The number of topics being learnt \hypertarget{class_type_topic_counts_a18f351c45c28ebc4be0f0d3df001fde4}{
\index{TypeTopicCounts@{TypeTopicCounts}!get\_\-num\_\-words@{get\_\-num\_\-words}}
\index{get\_\-num\_\-words@{get\_\-num\_\-words}!TypeTopicCounts@{TypeTopicCounts}}
\subsubsection[{get\_\-num\_\-words}]{\setlength{\rightskip}{0pt plus 5cm}word\_\-t TypeTopicCounts::get\_\-num\_\-words ()}}
\label{class_type_topic_counts_a18f351c45c28ebc4be0f0d3df001fde4}
The number of unique words for which the topic counts are maintained \hypertarget{class_type_topic_counts_a0a41df650f7c2975f7517d02deb6d868}{
\index{TypeTopicCounts@{TypeTopicCounts}!get\_\-topic\_\-stats@{get\_\-topic\_\-stats}}
\index{get\_\-topic\_\-stats@{get\_\-topic\_\-stats}!TypeTopicCounts@{TypeTopicCounts}}
\subsubsection[{get\_\-topic\_\-stats}]{\setlength{\rightskip}{0pt plus 5cm}pair$<$ {\bf TopKList} $\ast$$\ast$, {\bf TopKList} $\ast$ $>$ TypeTopicCounts::get\_\-topic\_\-stats ()}}
\label{class_type_topic_counts_a0a41df650f7c2975f7517d02deb6d868}
Get the TopicStats per topic \& the hot/top NUM\_\-TOP\_\-TOPICS topics. Used to print the topic stats for the top topics \hypertarget{class_type_topic_counts_a6eb9abe7c1ca5cfeaf15d49b910fd24f}{
\index{TypeTopicCounts@{TypeTopicCounts}!init@{init}}
\index{init@{init}!TypeTopicCounts@{TypeTopicCounts}}
\subsubsection[{init}]{\setlength{\rightskip}{0pt plus 5cm}void TypeTopicCounts::init (topic\_\-t {\em num\_\-topics\_\-})\hspace{0.3cm}{\ttfamily  \mbox{[}protected\mbox{]}}}}
\label{class_type_topic_counts_a6eb9abe7c1ca5cfeaf15d49b910fd24f}
\hypertarget{class_type_topic_counts_ab788633dc25d325dc47bd333b87ae574}{
\index{TypeTopicCounts@{TypeTopicCounts}!initialize@{initialize}}
\index{initialize@{initialize}!TypeTopicCounts@{TypeTopicCounts}}
\subsubsection[{initialize}]{\setlength{\rightskip}{0pt plus 5cm}void TypeTopicCounts::initialize ({\bf topicCounts} $\ast$$\ast$ {\em wtc}, \/  atomic$<$ topic\_\-t $>$ $\ast$ {\em tc})}}
\label{class_type_topic_counts_ab788633dc25d325dc47bd333b87ae574}
Initialize using and array of topicCounts. Used in testing. Refer TypeTopicCountsTest.cpp \hypertarget{class_type_topic_counts_a0f6527f9f996e4e39859a6cb266ebf12}{
\index{TypeTopicCounts@{TypeTopicCounts}!initialize@{initialize}}
\index{initialize@{initialize}!TypeTopicCounts@{TypeTopicCounts}}
\subsubsection[{initialize}]{\setlength{\rightskip}{0pt plus 5cm}void TypeTopicCounts::initialize ({\bf topicCounts} $\ast$ {\em wtc}, \/  atomic$<$ topic\_\-t $>$ $\ast$ {\em tc}, \/  word\_\-t {\em word} = {\ttfamily 0})}}
\label{class_type_topic_counts_a0f6527f9f996e4e39859a6cb266ebf12}
Initialize the structure using explicit topicCounts for word. Used in testing. Refer TypeTopicCountsTest.cpp \hypertarget{class_type_topic_counts_a1e51d6aa7ceb480b3b1e1a2e598a2486}{
\index{TypeTopicCounts@{TypeTopicCounts}!initialize\_\-from\_\-docs@{initialize\_\-from\_\-docs}}
\index{initialize\_\-from\_\-docs@{initialize\_\-from\_\-docs}!TypeTopicCounts@{TypeTopicCounts}}
\subsubsection[{initialize\_\-from\_\-docs}]{\setlength{\rightskip}{0pt plus 5cm}void TypeTopicCounts::initialize\_\-from\_\-docs (string {\em wfname}, \/  string {\em tfname})}}
\label{class_type_topic_counts_a1e51d6aa7ceb480b3b1e1a2e598a2486}
Reads documents using \hyperlink{class_document_reader}{DocumentReader}. For each document and for each word encountered, it updates the topic counts for that word based on the topic assignment. \hypertarget{class_type_topic_counts_a71ca87bf1f9cf612323f792594d3de29}{
\index{TypeTopicCounts@{TypeTopicCounts}!initialize\_\-from\_\-dump@{initialize\_\-from\_\-dump}}
\index{initialize\_\-from\_\-dump@{initialize\_\-from\_\-dump}!TypeTopicCounts@{TypeTopicCounts}}
\subsubsection[{initialize\_\-from\_\-dump}]{\setlength{\rightskip}{0pt plus 5cm}bool TypeTopicCounts::initialize\_\-from\_\-dump (string {\em fname}, \/  {\bf WordIndexDictionary} $\ast$ {\em local\_\-dict} = {\ttfamily NULL}, \/  {\bf WordIndexDictionary} $\ast$ {\em global\_\-dict} = {\ttfamily NULL}, \/  size\_\-t {\em offset} = {\ttfamily 0})}}
\label{class_type_topic_counts_a71ca87bf1f9cf612323f792594d3de29}
Reads the serialize dump (fname) in the protobuffere format into memory. The dump is generated using \hyperlink{class_type_topic_counts_ad5b4a0efaccdf397d696ef3a59ff5bc5}{dump()} method. The \hyperlink{class_document_reader}{DocumentReader} is used to read from the protobuf format dump file. There will be num\_\-words entries in the dump for topicCounts and the last entry is the n(t). So first we read num\_\-words topicCounts \& then n(t) \hypertarget{class_type_topic_counts_a54768567ed8fbf4cd34f2ff7a5222190}{
\index{TypeTopicCounts@{TypeTopicCounts}!initialize\_\-from\_\-string@{initialize\_\-from\_\-string}}
\index{initialize\_\-from\_\-string@{initialize\_\-from\_\-string}!TypeTopicCounts@{TypeTopicCounts}}
\subsubsection[{initialize\_\-from\_\-string}]{\setlength{\rightskip}{0pt plus 5cm}void TypeTopicCounts::initialize\_\-from\_\-string (word\_\-t {\em word}, \/  string \& {\em counts})}}
\label{class_type_topic_counts_a54768567ed8fbf4cd34f2ff7a5222190}
\hypertarget{class_type_topic_counts_ae8c2f500e74a2f6a6bb1f6e830c66142}{
\index{TypeTopicCounts@{TypeTopicCounts}!initialize\_\-from\_\-ttc@{initialize\_\-from\_\-ttc}}
\index{initialize\_\-from\_\-ttc@{initialize\_\-from\_\-ttc}!TypeTopicCounts@{TypeTopicCounts}}
\subsubsection[{initialize\_\-from\_\-ttc}]{\setlength{\rightskip}{0pt plus 5cm}void TypeTopicCounts::initialize\_\-from\_\-ttc ({\bf TypeTopicCounts} $\ast$ {\em ttc})}}
\label{class_type_topic_counts_ae8c2f500e74a2f6a6bb1f6e830c66142}
\hypertarget{class_type_topic_counts_a126d74c21ec8eda16a875711b9879f86}{
\index{TypeTopicCounts@{TypeTopicCounts}!print@{print}}
\index{print@{print}!TypeTopicCounts@{TypeTopicCounts}}
\subsubsection[{print}]{\setlength{\rightskip}{0pt plus 5cm}void TypeTopicCounts::print ()}}
\label{class_type_topic_counts_a126d74c21ec8eda16a875711b9879f86}
Dump the structure to log(INFO) \hypertarget{class_type_topic_counts_a8aecfbf940bbc235954488ef3d107075}{
\index{TypeTopicCounts@{TypeTopicCounts}!print@{print}}
\index{print@{print}!TypeTopicCounts@{TypeTopicCounts}}
\subsubsection[{print}]{\setlength{\rightskip}{0pt plus 5cm}string TypeTopicCounts::print (word\_\-t {\em word})}}
\label{class_type_topic_counts_a8aecfbf940bbc235954488ef3d107075}
\hypertarget{class_type_topic_counts_a8d29734547e3cbe1936282967b62c9e7}{
\index{TypeTopicCounts@{TypeTopicCounts}!replace@{replace}}
\index{replace@{replace}!TypeTopicCounts@{TypeTopicCounts}}
\subsubsection[{replace}]{\setlength{\rightskip}{0pt plus 5cm}void TypeTopicCounts::replace (word\_\-t {\em word}, \/  {\bf topicCounts} \& {\em tc})}}
\label{class_type_topic_counts_a8d29734547e3cbe1936282967b62c9e7}
Replace the counts for this word with those in tc \hypertarget{class_type_topic_counts_a4cdeb79b31cc51bf74b0cf2824aad62d}{
\index{TypeTopicCounts@{TypeTopicCounts}!upd\_\-count@{upd\_\-count}}
\index{upd\_\-count@{upd\_\-count}!TypeTopicCounts@{TypeTopicCounts}}
\subsubsection[{upd\_\-count}]{\setlength{\rightskip}{0pt plus 5cm}void TypeTopicCounts::upd\_\-count (word\_\-t {\em word}, \/  {\bf mapped\_\-vec} {\em delta}, \/  string {\em dbg} = {\ttfamily \char`\"{}\char`\"{}})}}
\label{class_type_topic_counts_a4cdeb79b31cc51bf74b0cf2824aad62d}
Update the counts for word using the delta map. The map contains the topic to count deltas. A lock is obtained on the word and is delegated to the relevant topicCounts Used by the background synchronizers \hypertarget{class_type_topic_counts_a6ccff3b11d661503a45bc382411af9ad}{
\index{TypeTopicCounts@{TypeTopicCounts}!upd\_\-count@{upd\_\-count}}
\index{upd\_\-count@{upd\_\-count}!TypeTopicCounts@{TypeTopicCounts}}
\subsubsection[{upd\_\-count}]{\setlength{\rightskip}{0pt plus 5cm}void TypeTopicCounts::upd\_\-count (word\_\-t {\em word}, \/  topic\_\-t {\em old\_\-topic}, \/  topic\_\-t {\em new\_\-topic}, \/  bool {\em ignore\_\-old\_\-topic} = {\ttfamily false})}}
\label{class_type_topic_counts_a6ccff3b11d661503a45bc382411af9ad}
Main update used by the updater filter. Decrements the old\_\-topic counts by 1 and increments the new\_\-topic counts by 1 for word. Acquire a lock. Find the old and new topic locations and update them using the topicCounts vector's methods. However the decrement and increment methods take an index and do fast updates. So there is some pointer arithmetic going on here to find the index into the vector using the position pointers. Also note that the basic structure used has the topic and count packed in a 64 bit integer. So whenever we want to refer to the topic or count individually we need to multiply or divide by 2 \hypertarget{class_type_topic_counts_adc1724643b2210fce240202fdfc5144c}{
\index{TypeTopicCounts@{TypeTopicCounts}!verify\_\-header@{verify\_\-header}}
\index{verify\_\-header@{verify\_\-header}!TypeTopicCounts@{TypeTopicCounts}}
\subsubsection[{verify\_\-header}]{\setlength{\rightskip}{0pt plus 5cm}int TypeTopicCounts::verify\_\-header ({\bf DocumentReader} \& {\em doc\_\-rdr})}}
\label{class_type_topic_counts_adc1724643b2210fce240202fdfc5144c}


\subsection{Friends And Related Function Documentation}
\hypertarget{class_type_topic_counts_a262cd29ee3b1d36569101e365d04b725}{
\index{TypeTopicCounts@{TypeTopicCounts}!Memcached\_\-Synchronizer@{Memcached\_\-Synchronizer}}
\index{Memcached\_\-Synchronizer@{Memcached\_\-Synchronizer}!TypeTopicCounts@{TypeTopicCounts}}
\subsubsection[{Memcached\_\-Synchronizer}]{\setlength{\rightskip}{0pt plus 5cm}friend class Memcached\_\-Synchronizer\hspace{0.3cm}{\ttfamily  \mbox{[}friend\mbox{]}}}}
\label{class_type_topic_counts_a262cd29ee3b1d36569101e365d04b725}


\subsection{Member Data Documentation}
\hypertarget{class_type_topic_counts_a11093a2580f604279b5799ef494a8e66}{
\index{TypeTopicCounts@{TypeTopicCounts}!num\_\-topics@{num\_\-topics}}
\index{num\_\-topics@{num\_\-topics}!TypeTopicCounts@{TypeTopicCounts}}
\subsubsection[{num\_\-topics}]{\setlength{\rightskip}{0pt plus 5cm}topic\_\-t {\bf TypeTopicCounts::num\_\-topics}\hspace{0.3cm}{\ttfamily  \mbox{[}protected\mbox{]}}}}
\label{class_type_topic_counts_a11093a2580f604279b5799ef494a8e66}
\hypertarget{class_type_topic_counts_ab1fcbc4b5558d7d8df4404d5db290e8d}{
\index{TypeTopicCounts@{TypeTopicCounts}!tokens\_\-per\_\-topic@{tokens\_\-per\_\-topic}}
\index{tokens\_\-per\_\-topic@{tokens\_\-per\_\-topic}!TypeTopicCounts@{TypeTopicCounts}}
\subsubsection[{tokens\_\-per\_\-topic}]{\setlength{\rightskip}{0pt plus 5cm}atomic$<$topic\_\-t$>$$\ast$ {\bf TypeTopicCounts::tokens\_\-per\_\-topic}\hspace{0.3cm}{\ttfamily  \mbox{[}protected\mbox{]}}}}
\label{class_type_topic_counts_ab1fcbc4b5558d7d8df4404d5db290e8d}
\hypertarget{class_type_topic_counts_aa31724ba039f4e58d2ac2d3344b94d46}{
\index{TypeTopicCounts@{TypeTopicCounts}!top\_\-topics@{top\_\-topics}}
\index{top\_\-topics@{top\_\-topics}!TypeTopicCounts@{TypeTopicCounts}}
\subsubsection[{top\_\-topics}]{\setlength{\rightskip}{0pt plus 5cm}{\bf TopKList} $\ast$ {\bf TypeTopicCounts::top\_\-topics}\hspace{0.3cm}{\ttfamily  \mbox{[}protected\mbox{]}}}}
\label{class_type_topic_counts_aa31724ba039f4e58d2ac2d3344b94d46}
\hypertarget{class_type_topic_counts_a1fd0fdd37107d5837fe5cc78191f5e8a}{
\index{TypeTopicCounts@{TypeTopicCounts}!topic\_\-stats@{topic\_\-stats}}
\index{topic\_\-stats@{topic\_\-stats}!TypeTopicCounts@{TypeTopicCounts}}
\subsubsection[{topic\_\-stats}]{\setlength{\rightskip}{0pt plus 5cm}{\bf TopKList}$\ast$$\ast$ {\bf TypeTopicCounts::topic\_\-stats}\hspace{0.3cm}{\ttfamily  \mbox{[}protected\mbox{]}}}}
\label{class_type_topic_counts_a1fd0fdd37107d5837fe5cc78191f5e8a}


The documentation for this class was generated from the following files:\begin{DoxyCompactItemize}
\item 
src/Unigram\_\-Model/TopicLearner/\hyperlink{_type_topic_counts_8h}{TypeTopicCounts.h}\item 
src/Unigram\_\-Model/TopicLearner/\hyperlink{_type_topic_counts_8cpp}{TypeTopicCounts.cpp}\end{DoxyCompactItemize}
